<?php
include("include/config.inc.php");
if(!isset($_SESSION['s_activIdsAdmin']))
{
	header("Location:checkLogin.php");
}
else
{
  $m=0;
  $invoiceArray   = array();  
  $selectContract = "SELECT  invoiceId,contractId,invoiceNo,qty,price,value,DATE_FORMAT(dateOfLoading,'%d-%m-%Y')AS dateOfLoading,vessel,
                             DATE_FORMAT(etdDate,'%d-%m-%Y')AS etdDate
                        FROM invoice
                       WHERE contractId = ".$_REQUEST['contractId'];
                            
  $selectContractRes = mysql_query($selectContract);
  while($invoiceRow = mysql_fetch_array($selectContractRes))
  {
    $invoiceArray[$m]['invoiceId']      = $invoiceRow['invoiceId'];
    $invoiceArray[$m]['contractId']     = $invoiceRow['contractId'];
  	$invoiceArray[$m]['invoiceNo']      = $invoiceRow['invoiceNo'];
  	$invoiceArray[$m]['qty']            = $invoiceRow['qty'];
    $invoiceArray[$m]['price']          = $invoiceRow['price'];
  	$invoiceArray[$m]['value']          = $invoiceRow['value'];
  	$invoiceArray[$m]['dateOfLoading']  = $invoiceRow['dateOfLoading'];
  	$invoiceArray[$m]['vessel']         = $invoiceRow['vessel'];
  	$invoiceArray[$m]['etdDate']        = $invoiceRow['etdDate'];
  	$m++;
  }
}
include("bottom.php");
$smarty->assign("invoiceArray",$invoiceArray);
$smarty->display("invoiceDetail.tpl");
?>